<script src="/statics/js/layer.js"></script>
<!-- 头部开始 -->
<div class="header">
<!--    <div class="header_r"><img src="<?=session('loginImg')?>" width="30"></div>-->
    <div class="header_l"><a href="javascript:history.back(-1)"></a></div>
    <div class="header_m">收入提现</div>
</div>
<!-- 头部结束 -->

<!--店铺基本信息开始-->
<div class="tixian-pic">
    <img src="/statics/images/money.png" width="120">
    <p>可提现金额</p>
    <p class="normal"><img src="/statics/images/ajax_loading.gif" /></p>
</div>
<div class="tixian-ok2">
    <button class="add cd-popup-trigger2">申请提现</button>
    <p>若没有绑定银行卡请先在卖家中心绑定</p>
</div>
<div class="tixian">
    <ul>
        <li><a href="javascript:void(0)"><span id="wait"><img src="/statics/images/ajax_loading.gif" /></span>待结算金额</a></li>
        <li><a href="javascript:void(0)"><span class="normal"><img src="/statics/images/ajax_loading.gif" /></span>可提现金额</a></li>
        <li><a href="javascript:void(0)"><span id="ing"><img src="/statics/images/ajax_loading.gif" /></span>提现中金额</a></li>
        <li><a href="javascript:void(0)"><span id="ytx"><img src="/statics/images/ajax_loading.gif" /></span>已提现金额</a></li>
    </ul>
</div>
<div class="jiangjin"><a href="/saler/bonus/sek/<?=$sek?>"><span></span>奖金明细</a></div>
<?php $getLastestBank = M('CustCash')->where(array('cust_id'=>session('loginUid')))->order(array('add_at'=>'desc'))->find();?>
<div class="cd-popup2" role="alert">
    <div class="cd-popup-container2">
        <div id="PopupLayer2" class="PopupLayer2"><a class="close cd-popup-close2"></a>
            <p class="xd-dz">填写提现信息</p>
            <div class="xd-xzdz2"><span>提现金额：</span><input type="text" placeholder="" itv="提现金额" class="needval" id="moneyval"></div>
            <?php $banks = M('CustBank')->where(array('cust_id'=>session('loginUid')))->order(array('is_default'=>'desc'))->select();?>
            <div class="xd-xzdz2"><span>选择银行：</span><select style="width:200px" id="bankid" class="needval" itv="提现银行">
            <option value="">选择提现银行</option>
            <?php if($banks){foreach($banks AS $vv){?>
            <option value="<?=$vv['bank_id']?>"><?=$vv['bank']?> <?=substr($vv['bank_card'],0,4).'********'.substr($vv['bank_card'],-4)?></option>
            <?php }}?>
            </select></div>
			<p class="canshu_n"><a href="javascript:void(0)" id="putCashAdd">确定</a></p>
        </div>
    </div>
</div>
<!--店铺基本信息结束-->

<!--<div class="fiex nav"> <a class="icon-shouye fiex_on" href="/index/index/sek/<?=$sek?>"><br />-->
  <!--首页</a> <a class="icon-fenlei" href="/cate/main/sek/<?=$sek?>"><br />-->
  <!--分类</a> <a class="icon-gouwu" href="/cart/index/sek/<?=$sek?>"><br />-->
  <!--购物车</a> <a class="icon-geren" href="/index/user/sek/<?=$sek?>"><br />-->
  <!--用户中心</a> </div>-->
<div class="fiex nav">
	<a class="icon-shouye" style="width:50%" href="/index/index/sek/<?=mySpreadSek(session('loginUid'))?>"><br />
		我的店铺</a> <a style="width:50%" class="icon-geren fiex_on" href="/saler/index/sek/<?=mySpreadSek(session('loginUid'))?>"><br />
	用户中心</a> </div>
<script>
	$(function(){
		$.get('/order/smoney',{'type':'1','enckey':'<?=md5("1".session("loginUid")."account")?>'},function(data){
			$('#wait').html('¥ '+data.data);
		},'json');
		$.get('/order/smoney',{'type':'2','enckey':'<?=md5("2".session("loginUid")."account")?>'},function(data){
			$('.normal').html('¥ '+data.data);
			if(data.data > 0){
				$('#moneyval').attr('placeholder','不大于'+data.data+'元');
			}else{
				$('#moneyval').val('无可提现金额');
				$('#moneyval').attr('disabled','1');
			}
		},'json');
		$.get('/order/smoney',{'type':'3','enckey':'<?=md5("3".session("loginUid")."account")?>'},function(data){
			$('#ing').html('¥ '+data.data);
		},'json');
		$.get('/order/smoney',{'type':'4','enckey':'<?=md5("4".session("loginUid")."account")?>'},function(data){
			$('#ytx').html('¥ '+data.data);
		},'json');
		$('#putCashAdd').click(function(){
			mcontinue = 1;
			$('.needval').each(function(){
				if(!$(this).val()){
					layer.msg($(this).attr('itv')+' 项不能为空', {icon: 0});
					mcontinue = 0;return false;
				}
			});
			if(mcontinue > 0){
				$.post('/saler/cashOut',{'dosubmit':'1','enckey':'<?=substr(md5(C("ENCKEY").session("loginUid")."cashOut"),3,8)?>','mon':$('#moneyval').val(),'bank':$('#bankid').val()},function(data){
					layer.msg(data.msg, {icon: data.code});
					if(data.code == '1'){
						setTimeout(function(){location.reload();},1000);
					}
				},'json');
			}
		});
	})
</script>

